﻿using System;
using System.Drawing;
using EmbeddedSharp.Core;

namespace EmbeddedSharp.Scripting.Visualization.Functions
{

    /// <summary>
    /// 
    /// usage:
    /// barchart(two_dimensional_list[, title]);
    /// 
    /// </summary>
    [Function("barChart",
        "Presents a bar chart from the given data",
        "barChart([[\"Canada\", 120], [\"France\", 150], [\"Germany\", 160], [\"Italy\", 180], [\"Japan\", 200], [\"Russia\", 220], [\"United Kingdom\", 250], [\"United States\", 300]])", "")]
    public class BarChartNode : VisualizationContextFuncNode
    {
        public BarChartNode()
            : base()
        {
            base.Value = "barChart";
        }

        public override object Evaluate()
        {
            int count = Parameters.Count;
            if (Parameters.Count < 1)
            {
                throw new Exception("usage: barChart()");
            }

            ListObject list = Parameters[count - 1].Evaluate() as ListObject;

            return string.Empty;
        }
    }
}
